package com.example.demo.Controller;

import com.example.demo.Service.FunctionMapService;
import org.springframework.stereotype.Controller;

import java.util.HashMap;

@Controller
public class FunctionMapImpl implements FunctionMapService {
    private HashMap<String, String> preMap = new HashMap<>();
    private HashMap<String, String> postMap = new HashMap<>();
    @Override
    public HashMap<String, String> getPreMap() {
        return preMap;
    }

    @Override
    public HashMap<String, String> getPostMap() {
        return postMap;
    }

    @Override
    public Boolean addPreMap(String ApiId, String FuncId) {
        preMap.put(ApiId,FuncId);
        return true;
    }

    @Override
    public Boolean addPostMap(String ApiId, String FuncId) {
        postMap.put(ApiId,FuncId);
        return true;
    }

    @Override
    public Boolean setPreMap(HashMap<String, String> preMap) {
        this.preMap = preMap;
        return true;
    }

    @Override
    public Boolean setPostMap(HashMap<String, String> postMap) {
        this.postMap = postMap;
        return true;
    }

    @Override
    public Boolean deletePreMap(String ApiId) {
        preMap.remove(ApiId);
        return true;
    }

    @Override
    public Boolean deletePostMap(String ApiId) {
        postMap.remove(ApiId);
        return true;
    }
}
